/**
*      author: Y_Yao
*      created: 2024-12-16 11:49:56
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
int dx[8] = {2,1,-1,-2,-2,-1,1,2};
int dy[8] = {1,2,2,1,-1,-2,-2,-1};
const int N = 1e9 + 7;
int n,m;

void solve()
{
    cin >> n >> m;
    int ans = n * n;
    unordered_set<int> hash;
    while(m--)
    {
        int ta,tb;
        cin >> ta >> tb;
        int c = (ta + tb) * (ta + tb + 1) / 2 + tb;
        if(!hash.count(c)) ans--;
        hash.insert(c);
        for(int i = 0;i < 8;i++)
        {
            int x = ta + dx[i],y = tb + dy[i];
            if(x < 1 || x > n || y < 1 || y > n) continue;
            int dest = (x + y) * (x + y + 1) / 2 + y;
            if(hash.count(dest)) continue;
            hash.insert(dest);
            ans--;
        }
    }
    cout << ans << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}